// pages/OrderReturnSure/OrderReturnSure.js
var app = getApp();
Page({

  /**
	 * 页面的初始数据
	 */
  data: {
    language: '',
    order_status: "",
    name: "",
    mobile: "",
    address: "",
    express_sn: "",
    deposit_total: "",
    express: "",
    id: ''
  },

  /**
	 * 生命周期函数--监听页面加载
	 */
  onLoad: function(options) {
    if (options.id) {
      this.setData({
        id: options.id
      });
    }
    this.getDetail();
  },

  /**
	 * 生命周期函数--监听页面初次渲染完成
	 */
  onReady: function() {
    let language = wx.getStorageSync('langIndex');
    this.setData({ 'language': language.en});
  },

  /**
	 * 生命周期函数--监听页面显示
	 */
  onShow: function() {

  },

  /**
	 * 生命周期函数--监听页面隐藏
	 */
  onHide: function() {

  },

  /**
	 * 生命周期函数--监听页面卸载
	 */
  onUnload: function() {

  },

  /**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
  onPullDownRefresh: function() {

  },

  /**
	 * 页面上拉触底事件的处理函数
	 */
  onReachBottom: function() {

  },

  /**
	 * 用户点击右上角分享
	 */
  onShareAppMessage: function() {

  },
  //获取详情
  getDetail() {
    var that = this;
    let urlStr = app.getNetAddresss('plugin.lease-toy.api.retreat.return.returnDetail');
    urlStr += '&order_id=' + this.data.id;
    app._getNetWork({
      url: urlStr,
      success: function(resdata) {
        var res = resdata.data;
        if (res.result == 1) {
          that.setData({
            order_status: res.data.return_name,
            name: res.data.lease_address.realname,
            mobile: res.data.lease_address.mobile,
            address: res.data.lease_address.address,
            express_sn: res.data.lease_express.express_sn,
            express: res.data.lease_express.express_company_name,
            deposit_total: res.data.deposit_total
          });
        }
      },
      fail: function(res) {
        console.log(res);
      }
    });
  }
});
